package com.situ.analytics.service.client;

import com.situ.mall.analytics.spi.model.back.CategoryBack;
import com.situ.mall.analytics.spi.model.back.ProductBack;
import com.situ.mall.analytics.spi.model.back.StockBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;


@FeignClient(value = "mall-gateway",contextId = "analytics-product-feign")
public interface ProductClient {

    @GetMapping("/api/products/key-metrics")
    ProductBack getKeyMetrics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate startDate,
                              @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate endDate);

    @GetMapping("/api/products/productsByCategory")
    List<Map<String, Object>> getProductCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate startDate,
                                               @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate endDate);


    @GetMapping("/api/products/getStockBack")
    List<Map<String, Object>> getStockBack(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate startDate,
                           @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate endDate);

}
